<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
{eval $user=$this->user; $setting=$this->setting;}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Tipask's Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset={TIPASK_CHARSET}">
<link media="all" type="text/css" href="css/admin/admincp.css" rel="stylesheet"/>
<script src="js/admin.js" type="text/javascript"></script>
</head>
<body>

<div class="container">
	<!--{if isset($message)}-->
		<!--{eval $type=isset($type)?$type:'correctmsg'; }-->
		<div class="{$type}"><p>{$message}</p></div>
	<!--{/if}-->
	<div class="mainbox nomargin">
		<form name="gatherFrom" {if isset($gather)}action="index.php?c=admin_gather&a=edit"{else}action="index.php?c=admin_gather&a=add"{/if} method="post" >
		<table class="opt">
				<tr>
					<th colspan="2">采集名称:</th>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110"><input type="text" class="txt" name="name" {if isset($gather['name'])}value="{$gather['name']}"{/if}/></td>
					<td>采集器名称设置，必填！</td>
				</tr>
				<tr>
					<th colspan="2">采集总数:</th>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110"><input class="txt" name="gathersize" id="gathersize" maxlength="5" size="5" {if isset($gather['counts'])}value="{$gather['counts']}"{/if}/></td>
					<td>设置采集的问题的个数,必须为整数，如25.</td>
				</tr>
				<tr>
					<th colspan="2">采集源:</th>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110">
						<select name="site" >
						<!--{loop $gathersites $key $site}-->
							<option  {if isset($gather['site']) && $gather['site']==$key }selected{/if} value="{$key}">{$site}</option>
						<!--{/loop}-->
						</select>
					</td>
					<td>要采集的网站。</td>
				</tr>
				<tr>
					<th colspan="2">源分类cid:</th>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110"><input class="txt" name="srccid" id="srccid" size="10" maxlength="15" {if isset($gather['srcid'])}value="{$gather['srcid']}"{/if}/></td>
					<td>查看分类链接地址可以知道分类的cid<br />例如：<br />百度：电脑网络http://zhidao.baidu.com/browse/74，cid是74；<br />腾讯问问：电脑数码http://wenwen.soso.com/z/c318767104.htm，cid是318767104<br /><font color="Red">注：腾讯问问不支持最底层分类</font></td>
				</tr>
				<tr>
					<th colspan="2">问题类型:</th>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110">
						<select name="status" >
							<option {if isset($gather['qstatus']) && $gather['qstatus'] == 2 }selected{/if} value="2">已解决</option>
							<option {if isset($gather['qstatus']) && $gather['qstatus'] == 1 }selected{/if} value="1">待解决</option>
						</select>
					</td>
					<td>请选择问题类型</td>
				</tr>
				<tr>
					<th colspan="2">导入到的分类:</th>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110"><span id="classid">
					<table cellspacing="0" cellpadding="0" border="0">
						<tr>
							<td>
								<select id="ClassLevel1" style="WIDTH: 125px" size="8" name="classlevel1">
									<option selected></option>
								</select>
							</td>
							<td width="20">
								<div align="center"><b>→</b></div>
							</td>
							<td>
								<select id="ClassLevel2" style="WIDTH: 125px" size="8" name="classlevel2">
									<option selected></option>
								</select>
							</td>
							<td width="20">
								<div id="jiantou" align="center"><b>→</b></div>
							</td>
							<td>
								<select id="ClassLevel3" style="WIDTH: 125px" onchange="getCidValue();" size="8" name="classlevel3">
									<option selected></option>
								</select>
							</td>
						</tr>
				</table></span></td>
				<td class="f14" >导入到本系统的某个分类</td>
				</tr>
				<tr>
					<th colspan="2">提问者姓名(多个;隔开):</th>
				</tr>
				<tr>
					<td><textarea class="textarea"  name="askusers">{if isset($askusersstr)}{$askusersstr}{/if}</textarea></td>
					<td valign="top"><font color="Red">至少填写一个注册用户</font></td>
				</tr>
				<tr>
					<th colspan="2">回答者(多个;隔开):</th>
				</tr>
				<tr>
					<td><textarea class="textarea"  name="answerusers">{if isset($answerusersstr)}{$answerusersstr}{/if}</textarea></td>
					<td valign="top"><font color="red">为了保证采集数据的完整至少需要4个网站注册用户且不能与提问者重复！</font></td>
				</tr>
			</table>
			<div class="opt">
				<input type="hidden" name="cid" value="0" />
				{if isset($gather)}<input type="hidden" name="gid" value="{$gather['id']}" />{/if}
				<input class="btn" tabindex="3" type="submit" value=" 提 交 " name="submit">
			</div>
		</form>
	</div>
</div>
<script type="text/javascript">
	var sortobj=eval('($category_js)');
	var g_ClassLevel1;
	var g_ClassLevel2;
	var g_ClassLevel3;
	var class_level_1=sortobj.category1;
	var class_level_2=sortobj.category2;
	var class_level_3=sortobj.category3;
	var button_noselect="不选择";

function getCidValue()
{
	var _cl1 = document.gatherFrom.ClassLevel1;
	var _cl2 = document.gatherFrom.ClassLevel2;
	var _cl3 = document.gatherFrom.ClassLevel3;
	var _cid = document.gatherFrom.cid;
	if(_cl1.value!=0) _cid.value = _cl1.value;
	if(_cl2.value!=0) _cid.value = _cl2.value;
	if(_cl3.value!=0) _cid.value = _cl3.value;
}
function FillClassLevel1(ClassLevel1)
{
    ClassLevel1.options[0] = new Option("aa", "0");
    for(i=0; i<class_level_1.length; i++)
    {
        ClassLevel1.options[i] = new Option(class_level_1[i][1], class_level_1[i][0]);
    }
    // ClassLevel1.options[0].selected = true;
    ClassLevel1.length = i;
}
function FillClassLevel2(ClassLevel2, class_level_1_id)
{
    ClassLevel2.options[0] = new Option(button_noselect, "");
    count = 1;
    for(i=0; i<class_level_2.length; i++){
    if(class_level_2[i][0].toString() == class_level_1_id) {
            ClassLevel2.options[count] = new Option(class_level_2[i][2], class_level_2[i][1]);
            count = count+1;}
    }
    ClassLevel2.options[0].selected = true;
    ClassLevel2.length = count;
}
function FillClassLevel3(ClassLevel3, class_level_2_id)
{
    ClassLevel3.options[0] = new Option(button_noselect, "");
    count = 1;
    for(i=0; i<class_level_3.length; i++) {
        if(class_level_3[i][0].toString() == class_level_2_id) {
            ClassLevel3.options[count] = new Option(class_level_3[i][2], class_level_3[i][1]);
            count = count+1;}
    }
    ClassLevel3.options[0].selected = true;
    ClassLevel3.length = count;       
}
function ClassLevel2_onchange()
{
    getCidValue();
    FillClassLevel3(g_ClassLevel3, g_ClassLevel2.value); 
    if (g_ClassLevel3.length <= 1) {  
     g_ClassLevel3.style.display = "none";
	 document.getElementById("jiantou").style.display = "none";
    }
    else {
     g_ClassLevel3.style.display = "";     
	 document.getElementById("jiantou").style.display = "";	 
    }       
}
 
function ClassLevel1_onchange()
{
    getCidValue();
    FillClassLevel2(g_ClassLevel2, g_ClassLevel1.value);
    ClassLevel2_onchange();
	
}
function InitClassLevelList(ClassLevel1, ClassLevel2, ClassLevel3)
{
    g_ClassLevel1=ClassLevel1;
    g_ClassLevel2=ClassLevel2;
    g_ClassLevel3=ClassLevel3;
    g_ClassLevel1.onchange = Function("ClassLevel1_onchange();");
    g_ClassLevel2.onchange = Function("ClassLevel2_onchange();");
    FillClassLevel1(g_ClassLevel1);
    ClassLevel1_onchange();
}
InitClassLevelList(document.gatherFrom.ClassLevel1, document.gatherFrom.ClassLevel2, document.gatherFrom.ClassLevel3);

var selected_id_list="{$cids[1]} {$cids[2]} {$cids[3]}"
var blank_pos = selected_id_list.indexOf(" ");
var find_blank = true;
if (blank_pos == -1) {
    find_blank = false;
    blank_pos = selected_id_list.length;
}
var id_str = selected_id_list.substr(0, blank_pos);
g_ClassLevel1.value = id_str;
ClassLevel1_onchange();

if (find_blank == true) {
    selected_id_list = selected_id_list.substr(blank_pos + 1,   selected_id_list.length - blank_pos - 1);
    blank_pos = selected_id_list.indexOf(" ");
    if (blank_pos == -1) {
        find_blank = false;
        blank_pos = selected_id_list.length;
    }
    id_str = selected_id_list.substr(0, blank_pos);
    g_ClassLevel2.value = id_str;
    ClassLevel2_onchange();

    if (find_blank == true) {
        selected_id_list = selected_id_list.substr(blank_pos + 1,  selected_id_list.length - blank_pos - 1);
        blank_pos = selected_id_list.indexOf(" ");
        if (blank_pos == -1) {
            find_blank = false;
            blank_pos = selected_id_list.length;
        }
        id_str = selected_id_list.substr(0, blank_pos);
        g_ClassLevel3.value = id_str;
    }
}	
</script>
</body>
</html>
